#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int a[11];
int b[11];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
	}
	int minn = *min_element(a, a + n);
	int maxx = *max_element(b, b + n);
	int ans1 = 0, ans2 = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] == minn)
		{
			ans1 = i;
		}
		if (b[i] == maxx)
		{
			ans2 = i;
		}
	}
	cout << ans1 + 1 << " " << ans2 + 1 << endl;
	return 0;
}